package org.tloss.proxyserver.filter;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ResourceFilterHandler implements FilterHandler {
	private int resourceCounter;

	public void doFilter(String URI, HttpServletRequest request,
			HttpServletResponse response, FilterChain chain)
			throws IOException, ServletException {
//		ProxyMangager mangager = ProxyMangager.getInstanse();
//		Map<String, ProxyContextEntry> map = mangager.getContextEntries();
//		int size;
//		if (map != null && (size = map.size()) > 0) {
//			String[] tmp = URI.split("/");
//			if (tmp != null && tmp.length >= 2) {
//				if (map.containsKey(tmp[1])) {
//					// redirect ko tang counter
//					return;
//				}
//			}
//			resourceCounter++;
//			resourceCounter = resourceCounter % size;
//			try {
//				ProxyContextEntry contextEntry = map.get(mangager
//						.getContextName().get(resourceCounter));
//				
//			} catch (IndexOutOfBoundsException e) {
//
//			}
//		}
		chain.doFilter(request, response);
	}

	public void init() {
		resourceCounter = -1;
	}

	public void destroy() {
		resourceCounter = -1;
	}

}
